<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Storage;

class UploadController extends Controller
{
    public function wangEditor(Request $request)
    {
        $file = $request->file('myFileName');
        $fileName = '/images/'.date('Y/m/d/').time().'.'.$file->getClientOriginalExtension();
        $flag = Storage::disk('admin')->put($fileName, file_get_contents($file->getRealPath()));
        if ($flag) {
            echo config('admin.upload.host').$fileName; exit;
        } else {
            echo "error|服务器端错误"; exit;
        }
    }
}
